﻿using NDF.Utilities;
using NDF.Web.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using UA.Data;

namespace UA.Web.Controllers
{
    public class ApplicationController : Controller
    {


        public ActionResult Index()
        {
            return this.View();
        }



        /// <summary>
        /// 查询列表
        /// </summary>
        /// <param name="appName"></param>
        /// <param name="page"></param>
        /// <param name="rows"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult Details(string appName, int page = 1, int rows = 10)
        {
            ApplicationAccessor accessor = new ApplicationAccessor();
            string name = appName ?? "";
            var pagingData = accessor.QueryPage(app => app.Name.Contains(name), page - 1, rows, app => app.ID);
            var data = new { total = pagingData.RowCount, rows = pagingData.Data };
            return this.JsonSerialize(data);
        }






    }
}
